/*
		Confirm({content:"我是中国人",okFn:function(){
			console.log(111);
			this.hide();
		}});
*/
var builder = require("../../mlib/layer/builder");
var merge = require("mlib/json/merge");
var touch = require("mlib/evt/touch");
var confirmRender = require("../layer/confirm.ejs");
module.exports = function(opts,callback) {
    opts = merge({        
        content :"", // 消息内容
        title : "温馨提示",
		okText : "确定" ,
		cancelText : "取消" ,
		okFn : function(){
			
		}
    }, opts || {});
	
    var aTimer = null ;
    var m_confirm = null ;

    m_confirm = builder.createFromHTML(confirmRender(opts), {
        "mask": true
    });

    m_confirm.show({
    	"afterAnimate":function(){
			var container = m_confirm.getOuter();
			touch.on(container, "tap",".cancel", function(){
				m_confirm.hide();
			});
			touch.on(container, "tap",".ok", function(evt){
				opts.okFn.call({hide:function(){m_confirm.hide();}});
			});
    	}
    });
    m_confirm.setMiddle();
}

